Accusoft.ImagXpress13.ActiveX
Insert Multiple Pages

The InsertPage method inserts a single page from one source TIFF file into another destination TIFF file. The InsertPage method allows the first page of a source multi-page TIFF file or a single page TIFF file to be inserted into a destination TIFF file. 

The InsertPages method supports setting a starting page in a source multi-page TIFF file and setting the number of pages to be inserted from the source TIFF file into the destination TIFF file.

The InsertPage method looks like this:

VB Example
Copy Code
Sub InsertPage( sourceFile As String, destFile As String, PageNbr As Long )

The InsertPages method looks like this:

VB Example
Copy Code
Sub InsertPages( sourceFile As String, sourcePageNbr As Long,
   NumPages As Long, destFile As String, destPageNbr As Long )

Inserting the First Pages of One TIFF Document into Another

Using InsertPage to insert the first 3 pages of a multipage TIFF document into another document requires code similar to the following:

 
Copy Code
Dim i As Integer
FileCopy sourceFile, tempSourceFile
For i = 1 To 3
    ImagXpress1.InsertPage tempSourceFile, destFile, i
    ImagXpress1.DeletePage tempSourceFile, 1
Next

The same task can be done with InsertPages with the following code:

 
Copy Code
ImagXpress1.InsertPages sourceFile, 1, 3, destFile, 1

Appending Pages of One TIFF Document into Another

Using the InsertPage method to append the first 3 pages of one TIFF document to the end of another TIFF document required code similar to this:

 
Copy Code
Dim numberOfPagesInDocument As Long
Dim startPageToAppend As Long
Dim i As Integer
numberOfPagesInDocument = ImagXpress1.NumPages(filename)
startPageToAppend = numberOfPagesInDocument
FileCopy sourceFile, tempSourceFile
For i = 1 To 3
   ImagXpress1.InsertPage tempSourceFile, destFile, startPageToAppend + i
   ImagXpress1.DeletePage tempSourceFile, 1
Next

The same task can be done using InsertPages with the following code:

 
Copy Code
ImagXpress1.InsertPages sourceFile, 1, 3, destFile, MaxLongConst

Creating a constant MaxLongConst of 2,147,483,647 above signals to the InsertPages method the intention to append pages to the end of the document. Setting any value greater than the number of pages in the destination file will append it to the end of the file.

 

 


©2019. Accusoft Corporation. All Rights Reserved.

Send Feedback